Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support loading env vars from secret files #1994

Merged

Conversation

acelaya
Copy link
Member

@acelaya acelaya commented Feb 10, 2024

Closes #1868

This PR updates how environment variables are read, so that, if the actual env var is not found, it tries to read the equivalent env var but with the _FILE suffix.

This way, if for example, DB_PASSWORD is not set, but DB_PASSWORD_FILE is, we treat the value as a file path, read it, and return its contents as the DB_PASSWORD value.

Regular env vars will always take precedence, so if both DB_PASSWORD and DB_PASSWORD_FILE are set, the latter will be ignored.

Copy link

codecov bot commented Feb 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (deef938) 96.90% compared to head (a8611f5) 96.90%.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #1994   +/-   ##
==========================================
  Coverage      96.90%   96.90%           
- Complexity      1342     1346    +4     
==========================================
  Files            247      247           
  Lines           4654     4660    +6     
==========================================
+ Hits            4510     4516    +6     
  Misses           144      144           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya merged commit 17792a1 into shlinkio:develop Feb 10, 2024
33 checks passed
@acelaya acelaya deleted the feature/docker-compose-secrets branch February 10, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the option to use file secrets
1 participant